clear all
set matsize 2000

cd "C:\Users\Carlos\Dropbox\albert-pilar-carlos\replication"

global dcontrols3 i.prov i.pop  frag_2008 vpsoe_2008 vpp_2008 viu_2008 vnat_2008 turn_2008  age_avg_2008 sh_un_2008 sh_edu_post_2001 sh_foreign_2008 exp_curr_2008 pr_tasac_m2_2008

* Run with Stata Version 14
* Date of latest successful replication: 21 July 2021

*****************************************************
**  Table 1
*****************************************************
use sss_main.dta, replace

estimates clear

qui eststo reg0: regress dfrag_2015 sh_un_2015_2008 $dcontrols3 [aw=g_census_2008], cluster(prov)
qui eststo reg1: regress dfrag_2015 sh_un_2015_2008 corruption_boom $dcontrols3 [aw=g_census_2008], cluster(prov)
qui eststo reg2: regress dfrag_2015 sh_un_2015_2008 sh_un_2015_2008_corruption_boom corruption_boom $dcontrols3 [aw=g_census_2008], cluster(prov)
qui eststo reg3: regress dfrag_1993 sh_un_2015_2008 sh_un_2015_2008_corruption_boom corruption_boom $dcontrols3 [aw=g_census_2008], cluster(prov)
qui eststo reg4: regress dfrag_1996 sh_un_2015_2008 sh_un_2015_2008_corruption_boom corruption_boom $dcontrols3 [aw=g_census_2008], cluster(prov)
qui eststo reg5: regress dfrag_2000 sh_un_2015_2008 sh_un_2015_2008_corruption_boom corruption_boom $dcontrols3 [aw=g_census_2008], cluster(prov)
qui eststo reg6: regress dfrag_2004 sh_un_2015_2008 sh_un_2015_2008_corruption_boom corruption_boom $dcontrols3 [aw=g_census_2008], cluster(prov)

outreg2 [reg0 reg1 reg2 reg3 reg4 reg5 reg6] using "table_1.xls", sortvar(sh_un_2015_2008_corruption_boom sh_un_2015_2008 corruption_boom   frag_2008 vpsoe_2008 vpp_2008 viu_2008 vnat_2008 turn_2008 frag_2008  age_avg_2008 sh_un_2008 sh_edu_post_2001 sh_foreign_2008  exp_curr_2008 pr_tasac_m2_2008) keep(sh_un_2015_2008_corruption_boom sh_un_2015_2008 corruption_boom)  label se replace dec(3)

*****************************************************
**  Table 2
*****************************************************
use sss_main.dta, replace

estimates clear
qui eststo vmain_2015c:  regress dvmain_2015 sh_un_2015_2008 corruption_boom  $dcontrols3                                [aw=g_census_2008], cluster(prov)
qui eststo vmain_2015i:  regress dvmain_2015 sh_un_2015_2008_corruption_boom sh_un_2015_2008 corruption_boom  $dcontrols3     [aw=g_census_2008], cluster(prov)
qui eststo vpp_2015c:    regress dvpp_2015 sh_un_2015_2008 corruption_boom $dcontrols3                               [aw=g_census_2008], cluster(prov)
qui eststo vpp_2015i:    regress dvpp_2015 sh_un_2015_2008_corruption_boom sh_un_2015_2008 corruption_boom $dcontrols3       [aw=g_census_2008], cluster(prov)
qui eststo vpsoe_2015c:  regress dvpsoe_2015 sh_un_2015_2008 corruption_boom $dcontrols3                           [aw=g_census_2008], cluster(prov)
qui eststo vpsoe_2015i:  regress dvpsoe_2015 sh_un_2015_2008_corruption_boom sh_un_2015_2008 corruption_boom $dcontrols3 [aw=g_census_2008], cluster(prov)

outreg2 [vmain_2015c vmain_2015i vpp_2015c vpp_2015i vpsoe_2015c vpsoe_2015i  ] using "table_2.xls", sortvar(sh_un_2015_2008_corruption_boom sh_un_2015_2008 corruption_boom ) keep(sh_un_2015_2008_corruption_boom sh_un_2015_2008 corruption_boom )dec(3) label se replace

*****************************************************
**  Table 3
*****************************************************
use sss_main.dta, replace

estimates clear
qui eststo vpod_2015c: regress dvpod_2015 sh_un_2015_2008 corruption_boom $dcontrols3      [aw=g_census_2008], cluster(prov)
qui eststo vcs_2015c:  regress dvcs_2015 sh_un_2015_2008 corruption_boom $dcontrols3       [aw=g_census_2008], cluster(prov)
qui eststo viu_2015c:  regress dviu_2015 sh_un_2015_2008 corruption_boom $dcontrols3       [aw=g_census_2008], cluster(prov)
qui eststo voth_2015c: regress dvoth_2015 sh_un_2015_2008 corruption_boom $dcontrols3       [aw=g_census_2008], cluster(prov)
qui eststo turn_2015c: regress dturn_2015 sh_un_2015_2008 corruption_boom $dcontrols3      [aw=g_census_2008], cluster(prov)

qui eststo vpod_2015i: regress dvpod_2015 sh_un_2015_2008_corruption_boom sh_un_2015_2008 corruption_boom $dcontrols3 [aw=g_census_2008], cluster(prov)
qui eststo vcs_2015i:  regress dvcs_2015 sh_un_2015_2008_corruption_boom sh_un_2015_2008 corruption_boom $dcontrols3  [aw=g_census_2008], cluster(prov)
qui eststo viu_2015i:  regress dviu_2015 sh_un_2015_2008_corruption_boom sh_un_2015_2008 corruption_boom $dcontrols3  [aw=g_census_2008], cluster(prov)
qui eststo voth_2015i: regress dvoth_2015 sh_un_2015_2008_corruption_boom sh_un_2015_2008 corruption_boom $dcontrols3 [aw=g_census_2008], cluster(prov)
qui eststo turn_2015i: regress dturn_2015 sh_un_2015_2008_corruption_boom sh_un_2015_2008 corruption_boom $dcontrols3 [aw=g_census_2008], cluster(prov)

outreg2 [vpod_2015c vpod_2015i vcs_2015c vcs_2015i viu_2015c viu_2015i voth_2015c voth_2015i turn_2015c turn_2015i] /*
*/using "table_3.xls", sortvar(sh_un_2015_2008_corruption_boom sh_un_2015_2008 corruption_boom) keep(sh_un_2015_2008_corruption_boom sh_un_2015_2008 corruption_boom) dec(3) label se replace

*****************************************************
**  Table 4
*****************************************************
use sss_main.dta, replace

estimates clear
qui eststo reg0: regress dfrag_2011 sh_un_2011_2008 corruption_boom $dcontrols3 [aw=g_census_2008], cluster(prov)
qui eststo reg1: regress dfrag_2011 sh_un_2011_2008 sh_un_2011_2008_corruption_boom corruption_boom $dcontrols3 [aw=g_census_2008], cluster(prov)
qui eststo reg2: regress dvmain_2011 sh_un_2011_2008 sh_un_2011_2008_corruption_boom corruption_boom $dcontrols3 [aw=g_census_2008], cluster(prov)
qui eststo reg3: regress dvpsoe_2011 sh_un_2011_2008 sh_un_2011_2008_corruption_boom corruption_boom $dcontrols3 [aw=g_census_2008], cluster(prov)
qui eststo reg4: regress dvpp_2011 sh_un_2011_2008 sh_un_2011_2008_corruption_boom corruption_boom $dcontrols3 [aw=g_census_2008], cluster(prov)
qui eststo reg5: regress dturn_2011 sh_un_2011_2008 sh_un_2011_2008_corruption_boom corruption_boom $dcontrols3 [aw=g_census_2008], cluster(prov)

outreg2 [reg0 reg1 reg2 reg3 reg4 reg5] /*
*/using "table_4.xls", sortvar(sh_un_2011_2008_corruption_boom sh_un_2011_2008 corruption_boom) keep(sh_un_2011_2008_corruption_boom sh_un_2011_2008 corruption_boom) dec(3) label se replace

*****************************************************
**  Figure 1
*****************************************************
use sss_cis.dta, replace

twoway (line CIS year, sort), xlabel(2000 2004 2008 2011 2015) ytitle("% respondents") xtitle("") legend(off) graphregion(fcolor(white))

graph export "figure_1.png", replace height(661) width(908)

*****************************************************
**  Figure 2
*****************************************************
use sss_unemrate.dta, replace

*i) Corruption=1
twoway (line unemploymentrate_c year, xtitle("")  xlabel(2000 2004 2008 2011 2015) yaxis(1) ytitle(Unemployed) graphregion(fcolor(white))) (line votesfragmentation_c year, lpattern(dash) xtitle("")  yaxis(2) ytitle(Fragmentation, axis(2)) graphregion(fcolor(white) ))
graph export "figure_2_a.png", replace height(661) width(908)

*ii) Corruption=0
twoway (line unemploymentrate_nc year, ylabel(4 (2) 14, axis(1)) xtitle("")  xlabel(2000 2004 2008 2011 2015) yaxis(1)  ytitle(Unemployed) graphregion(fcolor(white))) (line votesfragmentation_nc year, yscale(range(2 4) axis(2)) ylabel(2 (.5) 4, axis(2)) lpattern(dash) xtitle("")  yaxis(2)  ytitle(Fragmentation, axis(2)) graphregion(fcolor(white) ))

graph export "figure_2_b.png", replace height(661) width(908)


*****************************************************
**  Figure 3
*****************************************************
use sss_main.dta, replace

   foreach y in 1993 1996 2000 2004 2008 2011 2015 {
   regress dfrag_`y' sh_un_2015_2008 $dcontrols3 [aw=g_census_2008], cluster(prov)
   estimates store reg_`y'
  }
   coefplot (reg_1993, aseq(1993) \ reg_1996, aseq(1996) \ reg_2000, aseq(2000) \ reg_2004, aseq(2004) \ reg_2008, aseq(2008) \ reg_2011, aseq(2011) \ reg_2015, aseq(2015)), keep(sh_un_2015_2008) vertical levels(95 90) ciopts(recast(. rcap))  yline(0, lwidth(vthin) lpattern(dash))   legend(off) xline(2008, lwidth(vthin) lpattern(dash)) graphregion(color(white)) swapnames ytitle("Effect of {&Delta}%Unem.") ylabel(-0.03(.01)0.03)

graph export "figure_3.png", replace height(661) width(908)


*****************************************************
**  Figure 4
*****************************************************
use sss_main.dta, replace

gen uc15=sh_un_2015_2008_corruption_boom
gen unc15=sh_un_2015_2008_ncorruption

***combine c=0 & c=1
   foreach y in 1993 1996 2000 2004 2008 2011 2015 {
   regress dfrag_`y' uc15 unc15 corruption_boom $dcontrols3 [aw=g_census_2008], cluster(prov)
   estimates store reg_`y'_1
  }
  rename uc15 uc15aux
  rename unc15 unc15aux
  gen uc15 = unc15aux
  gen unc15 = uc15aux
   foreach y in 1993 1996 2000 2004 2008 2011 2015 {
   regress dfrag_`y' uc15 unc15 corruption_boom $dcontrols3 [aw=g_census_2008], cluster(prov)
   estimates store reg_`y'_2
  }
    
   coefplot (reg_1993_1, aseq(1993) offset(.05) mcolor(navy) ciopts(recast(. rcap) color(navy))) (reg_1993_2, aseq(1993) mcolor(green) ciopts(recast(. rcap) color(green) color(.green))) (reg_1996_1, aseq(1996) offset(.05)) (reg_1996_2, aseq(1996)) (reg_2000_1, aseq(2000) offset(.05)) (reg_2000_2, aseq(2000)) (reg_2004_1, aseq(2004) offset(.05)) (reg_2004_2, aseq(2004)) (reg_2008_1, aseq(2008) offset(.05)) (reg_2008_2, aseq(2008)) (reg_2011_1, aseq(2011) offset(.05)) (reg_2011_2, aseq(2011)) (reg_2015_1, aseq(2015) offset(.05)) (reg_2015_2, aseq(2015)), keep(uc15) vertical levels(95 90) ciopts(recast(. rcap))  yline(0, lwidth(vthin) lpattern(dash))   legend(off) xline(2008, lwidth(vthin) lpattern(dash)) graphregion(color(white)) swapnames ytitle("Effect of {&Delta}%Unem") ylabel(-0.04(.02)0.08)

graph export "figure_4_a.png", replace height(661) width(908)


***interaction
   foreach y in 1993 1996 2000 2004 2008 2011 2015 {
   regress dfrag_`y' sh_un_2015_2008 sh_un_2015_2008_corruption_boom corruption_boom $dcontrols3 [aw=g_census_2008], cluster(prov)
   estimates store reg_`y'
  }
   coefplot (reg_1993, aseq(1993) \ reg_1996, aseq(1996) \ reg_2000, aseq(2000) \ reg_2004, aseq(2004) \ reg_2008, aseq(2008) \ reg_2011, aseq(2011) \ reg_2015, aseq(2015)), keep(sh_un_2015_2008_corruption_boom) vertical levels(95 90) ciopts(recast(. rcap))  yline(0, lwidth(vthin) lpattern(dash))   legend(off) xline(2008, lwidth(vthin) lpattern(dash)) graphregion(color(white)) swapnames ytitle("Effect of {&Delta}%Unem. x Corruption") ylabel(-0.04(.02)0.08)
   
graph export "figure_4_b.png", replace height(661) width(908)

*****************************************************
**  Figure 5
*****************************************************
use sss_main.dta, replace

   foreach y in 1993 1996 2000 2004 2008 2011 2015 {
   regress dfrag_`y' sh_un_2015_2008  corruption_boom $dcontrols3 [aw=g_census_2008], cluster(prov)
   estimates store reg_`y'
  }
   coefplot (reg_1993, aseq(1993) \ reg_1996, aseq(1996) \ reg_2000, aseq(2000) \ reg_2004, aseq(2004) \ reg_2008, aseq(2008) \ reg_2011, aseq(2011) \ reg_2015, aseq(2015)), keep(corruption_boom) vertical levels(95 90) ciopts(recast(. rcap))  yline(0, lwidth(vthin) lpattern(dash))   legend(off) xline(2008, lwidth(vthin) lpattern(dash)) graphregion(color(white)) swapnames ytitle("Effect of Corruption") ylabel(-0.08(.02)0.10)
   
graph export "figure_5.png", replace height(661) width(908)


*****************************************************
**  Appendix A
*****************************************************

*****************************************************
**  Figure A1
*****************************************************
use sss_main.dta, replace

twoway (histogram sh_un_2015_2008 if corruption_boom==1, lcolor(gs12) fcolor(gs12)) ///
       (histogram sh_un_2015_2008 if corruption_boom==0, fcolor(none) lcolor(red) legend(order(1 "Corr=1" 2 "Corr=0" )) xtitle("{&Delta}%Unem.") graphregion(fcolor(white)))
	   
graph export "figure_a1.png", replace height(661) width(908)
	   
*****************************************************
**  Figure A2
*****************************************************
use sss_main.dta, replace

twoway (histogram frag_2008, lcolor(gs12) fcolor(gs12)) ///
       (histogram frag_2015, fcolor(none) lcolor(red) legend(order(1 "2008" 2 "2015" )) xtitle("Fragmentation") graphregion(fcolor(white)))
	   
graph export "figure_a2.png", replace height(661) width(908)


*****************************************************
**  Figure A3
*****************************************************
use sss_main.dta, replace

foreach y in 1993 1996 2000 2004 2008 2011 2015 {
regress dfrag_`y' sh_un_2015_2008 [aw=g_census_2008], cluster(prov)
estimates store reg_`y'
}
coefplot (reg_1993, aseq(1993) \ reg_1996, aseq(1996) \ reg_2000, aseq(2000) \ reg_2004, aseq(2004) \ reg_2008, aseq(2008) \ reg_2011, aseq(2011) \ reg_2015, aseq(2015)), keep(sh_un_2015_2008) vertical levels(95 90) ciopts(recast(. rcap))  yline(0, lwidth(vthin) lpattern(dash))   legend(off) xline(2008, lwidth(vthin) lpattern(dash)) graphregion(color(white)) swapnames ytitle("Effect of {&Delta}%Unem.") ylabel(-0.04(.02)0.10)

graph export "figure_a3.png", replace height(661) width(908)

*****************************************************
**  Figure A4
*****************************************************
use sss_main.dta, replace

global dcontrols1 i.prov i.pop

foreach y in 1993 1996 2000 2004 2008 2011 2015 {
regress dfrag_`y' sh_un_2015_2008 $dcontrols1 [aw=g_census_2008], cluster(prov)
estimates store reg_`y'
}
coefplot (reg_1993, aseq(1993) \ reg_1996, aseq(1996) \ reg_2000, aseq(2000) \ reg_2004, aseq(2004) \ reg_2008, aseq(2008) \ reg_2011, aseq(2011) \ reg_2015, aseq(2015)), keep(sh_un_2015_2008) vertical levels(95 90) ciopts(recast(. rcap))  yline(0, lwidth(vthin) lpattern(dash))   legend(off) xline(2008, lwidth(vthin) lpattern(dash)) graphregion(color(white)) swapnames ytitle("Effect of {&Delta}%Unem.") ylabel(-0.04(.02)0.10)

graph export "figure_a4.png", replace height(661) width(908)
  

*****************************************************
**  Figure A5
*****************************************************
use sss_main.dta, replace

*MAIN PARTIES
estimates clear
   foreach y in  1993 1996 2000 2004 2008 2011 2015 {
   ge dif_vmain_`y'= vmain_`y'-vmain_2008
   }
   foreach y in 1993 1996 2000 2004 2008 2011 2015 {
   regress dif_vmain_`y' sh_un_2015_2008  corruption_boom $dcontrols3 [aw=g_census_2008], cluster(prov)
   estimates store reg_`y'
  }
*Figure effect incr. unemployment
coefplot (reg_1993, aseq(1993) \ reg_1996, aseq(1996) \ reg_2000, aseq(2000) \ reg_2004, aseq(2004) \ reg_2008, aseq(2008) \ reg_2011, aseq(2011) \ reg_2015, aseq(2015)), keep(sh_un_2015_2008) vertical levels(95 90) ciopts(recast(. rcap))  yline(0, lwidth(vthin) lpattern(dash))   legend(off) xline(2008, lwidth(vthin) lpattern(dash)) graphregion(color(white)) swapnames ytitle("Effect of {&Delta}%Unemployment") 
graph export "figure_a5_a_1.png", replace height(661) width(908)

*Figure effect corruption
coefplot (reg_1993, aseq(1993) \ reg_1996, aseq(1996) \ reg_2000, aseq(2000) \ reg_2004, aseq(2004) \ reg_2008, aseq(2008) \ reg_2011, aseq(2011) \ reg_2015, aseq(2015)), keep(corruption_boom) vertical levels(95 90) ciopts(recast(. rcap))  yline(0, lwidth(vthin) lpattern(dash))   legend(off) xline(2008, lwidth(vthin) lpattern(dash)) graphregion(color(white)) swapnames ytitle("Effect of Corruption") 
graph export "figure_a5_a_2.png", replace height(661) width(908)

*PP
estimates clear
  foreach y in  1993 1996 2000 2004 2008 2011 2015 {
   ge dif_vpp_`y'= vpp_`y'-vpp_2008
   }
   foreach y in 1993 1996 2000 2004 2008 2011 2015 {
   regress dif_vpp_`y' sh_un_2015_2008  corruption_boom $dcontrols3 [aw=g_census_2008], cluster(prov)
   estimates store reg_`y'
  }
*Figure effect incr. unemployment
coefplot (reg_1993, aseq(1993) \ reg_1996, aseq(1996) \ reg_2000, aseq(2000) \ reg_2004, aseq(2004) \ reg_2008, aseq(2008) \ reg_2011, aseq(2011) \ reg_2015, aseq(2015)), keep(sh_un_2015_2008) vertical levels(95 90) ciopts(recast(. rcap))  yline(0, lwidth(vthin) lpattern(dash))   legend(off) xline(2008, lwidth(vthin) lpattern(dash)) graphregion(color(white)) swapnames ytitle("Effect of {&Delta}%Unemployment") 
graph export "figure_a5_b_1.png", replace height(661) width(908)

*Figure effect corruption
coefplot (reg_1993, aseq(1993) \ reg_1996, aseq(1996) \ reg_2000, aseq(2000) \ reg_2004, aseq(2004) \ reg_2008, aseq(2008) \ reg_2011, aseq(2011) \ reg_2015, aseq(2015)), keep(corruption_boom) vertical levels(95 90) ciopts(recast(. rcap))  yline(0, lwidth(vthin) lpattern(dash))   legend(off) xline(2008, lwidth(vthin) lpattern(dash)) graphregion(color(white)) swapnames ytitle("Effect of Corruption") 
graph export "figure_a5_b_2.png", replace height(661) width(908)

*PSOE
estimates clear
  foreach y in  1993 1996 2000 2004 2008 2011 2015 {
   ge dif_vpsoe_`y'= vpsoe_`y'-vpsoe_2008
   }
   foreach y in 1993 1996 2000 2004 2008 2011 2015 {
   regress dif_vpsoe_`y' sh_un_2015_2008  corruption_boom $dcontrols3 [aw=g_census_2008], cluster(prov)
   estimates store reg_`y'
  }
*Figure effect incr. unemployment
coefplot (reg_1993, aseq(1993) \ reg_1996, aseq(1996) \ reg_2000, aseq(2000) \ reg_2004, aseq(2004) \ reg_2008, aseq(2008) \ reg_2011, aseq(2011) \ reg_2015, aseq(2015)), keep(sh_un_2015_2008) vertical levels(95 90) ciopts(recast(. rcap))  yline(0, lwidth(vthin) lpattern(dash))   legend(off) xline(2008, lwidth(vthin) lpattern(dash)) graphregion(color(white)) swapnames ytitle("Effect of {&Delta}%Unemployment") 
graph export "figure_a5_c_1.png", replace height(661) width(908)
      
*Figure effect corruption
coefplot (reg_1993, aseq(1993) \ reg_1996, aseq(1996) \ reg_2000, aseq(2000) \ reg_2004, aseq(2004) \ reg_2008, aseq(2008) \ reg_2011, aseq(2011) \ reg_2015, aseq(2015)), keep(corruption_boom) vertical levels(95 90) ciopts(recast(. rcap))  yline(0, lwidth(vthin) lpattern(dash))   legend(off) xline(2008, lwidth(vthin) lpattern(dash)) graphregion(color(white)) swapnames ytitle("Effect of Corruption") 
graph export "figure_a5_c_2.png", replace height(661) width(908)


*****************************************************
**  Figure A6
*****************************************************
use sss_main.dta, replace

gen uc15=sh_un_2015_2008_corruption_boom
gen unc15=sh_un_2015_2008_ncorruption

*MAIN PARTIES
*corruption=1
  foreach y in  1993 1996 2000 2004 2008 2011 2015 {
   ge dif_vmain_`y'= vmain_`y'-vmain_2008
   }
   foreach y in 1993 1996 2000 2004 2008 2011 2015 {
   regress dif_vmain_`y' uc15 unc15 corruption_boom $dcontrols3 [aw=g_census_2008], cluster(prov)
   estimates store reg_`y'
  }
   coefplot (reg_1993, aseq(1993) \ reg_1996, aseq(1996) \ reg_2000, aseq(2000) \ reg_2004, aseq(2004) \ reg_2008, aseq(2008) \ reg_2011, aseq(2011) \ reg_2015, aseq(2015)), keep(uc15) vertical levels(95 90) ciopts(recast(. rcap))  yline(0, lwidth(vthin) lpattern(dash))   legend(off) xline(2008, lwidth(vthin) lpattern(dash)) graphregion(color(white)) swapnames ytitle("Effect of {&Delta}%Unem. if Corruption=1") ylabel(-1(.2)0.4)
graph export "figure_a6_a_1.png", replace height(661) width(908)
   

*corruption=0
   foreach y in 1993 1996 2000 2004 2008 2011 2015 {
   regress dif_vmain_`y' uc15 unc15 corruption_boom $dcontrols3 [aw=g_census_2008], cluster(prov)
   estimates store reg_`y'
  }
   coefplot (reg_1993, aseq(1993) \ reg_1996, aseq(1996) \ reg_2000, aseq(2000) \ reg_2004, aseq(2004) \ reg_2008, aseq(2008) \ reg_2011, aseq(2011) \ reg_2015, aseq(2015)), keep(unc15) vertical levels(95 90) ciopts(recast(. rcap))  yline(0, lwidth(vthin) lpattern(dash))   legend(off) xline(2008, lwidth(vthin) lpattern(dash)) graphregion(color(white)) swapnames ytitle("Effect of {&Delta}%Unem. if Corruption=0") ylabel(-1(.2)0.4)   
graph export "figure_a6_a_2.png", replace height(661) width(908)


*interaction
   foreach y in 1993 1996 2000 2004 2008 2011 2015 {
   regress dif_vmain_`y' sh_un_2015_2008 sh_un_2015_2008_corruption_boom corruption_boom $dcontrols3 [aw=g_census_2008], cluster(prov)
   estimates store reg_`y'
  }
   coefplot (reg_1993, aseq(1993) \ reg_1996, aseq(1996) \ reg_2000, aseq(2000) \ reg_2004, aseq(2004) \ reg_2008, aseq(2008) \ reg_2011, aseq(2011) \ reg_2015, aseq(2015)), keep(sh_un_2015_2008_corruption_boom) vertical levels(95 90) ciopts(recast(. rcap))  yline(0, lwidth(vthin) lpattern(dash))   legend(off) xline(2008, lwidth(vthin) lpattern(dash)) graphregion(color(white)) swapnames ytitle("Effect of {&Delta}%Unem. x Corruption") ylabel(-1(.2)0.4)   
graph export "figure_a6_a_3.png", replace height(661) width(908)

*****PP
*corruption=1
  foreach y in  1993 1996 2000 2004 2008 2011 2015 {
   ge dif_vpp_`y'= vpp_`y'-vpp_2008
   }
   foreach y in 1993 1996 2000 2004 2008 2011 2015 {
   regress dif_vpp_`y' uc15 unc15 corruption_boom $dcontrols3 [aw=g_census_2008], cluster(prov)
   estimates store reg_`y'
  }
   coefplot (reg_1993, aseq(1993) \ reg_1996, aseq(1996) \ reg_2000, aseq(2000) \ reg_2004, aseq(2004) \ reg_2008, aseq(2008) \ reg_2011, aseq(2011) \ reg_2015, aseq(2015)), keep(uc15) vertical levels(95 90) ciopts(recast(. rcap))  yline(0, lwidth(vthin) lpattern(dash))   legend(off) xline(2008, lwidth(vthin) lpattern(dash)) graphregion(color(white)) swapnames ytitle("Effect of {&Delta}%Unem. if Corruption=1") ylabel(-0.6(.2)0.4)
graph export "figure_a6_b_1.png", replace height(661) width(908)   

*corruption=0
   foreach y in 1993 1996 2000 2004 2008 2011 2015 {
   regress dif_vpp_`y' uc15 unc15 corruption_boom $dcontrols3 [aw=g_census_2008], cluster(prov)
   estimates store reg_`y'
  }
   coefplot (reg_1993, aseq(1993) \ reg_1996, aseq(1996) \ reg_2000, aseq(2000) \ reg_2004, aseq(2004) \ reg_2008, aseq(2008) \ reg_2011, aseq(2011) \ reg_2015, aseq(2015)), keep(unc15) vertical levels(95 90) ciopts(recast(. rcap))  yline(0, lwidth(vthin) lpattern(dash))   legend(off) xline(2008, lwidth(vthin) lpattern(dash)) graphregion(color(white)) swapnames ytitle("Effect of {&Delta}%Unem. if Corruption=0") ylabel(-0.6(.2)0.4)
 graph export "figure_a6_b_2.png", replace height(661) width(908)   

*interaction
   foreach y in 1993 1996 2000 2004 2008 2011 2015 {
   regress dif_vpp_`y' sh_un_2015_2008 sh_un_2015_2008_corruption_boom corruption_boom $dcontrols3 [aw=g_census_2008], cluster(prov)
   estimates store reg_`y'
  }
   coefplot (reg_1993, aseq(1993) \ reg_1996, aseq(1996) \ reg_2000, aseq(2000) \ reg_2004, aseq(2004) \ reg_2008, aseq(2008) \ reg_2011, aseq(2011) \ reg_2015, aseq(2015)), keep(sh_un_2015_2008_corruption_boom) vertical levels(95 90) ciopts(recast(. rcap))  yline(0, lwidth(vthin) lpattern(dash))   legend(off) xline(2008, lwidth(vthin) lpattern(dash)) graphregion(color(white)) swapnames ytitle("Effect of {&Delta}%Unem. x Corruption") ylabel(-0.6(.2)0.4)
graph export "figure_a6_b_3.png", replace height(661) width(908)   

*****2015 PSOE
*corruption=1
  foreach y in  1993 1996 2000 2004 2008 2011 2015 {
   ge dif_vpsoe_`y'= vpsoe_`y'-vpsoe_2008
   }
   foreach y in 1993 1996 2000 2004 2008 2011 2015 {
   regress dif_vpsoe_`y' uc15 unc15 corruption_boom $dcontrols3 [aw=g_census_2008], cluster(prov)
   estimates store reg_`y'
  }
   coefplot (reg_1993, aseq(1993) \ reg_1996, aseq(1996) \ reg_2000, aseq(2000) \ reg_2004, aseq(2004) \ reg_2008, aseq(2008) \ reg_2011, aseq(2011) \ reg_2015, aseq(2015)), keep(uc15) vertical levels(95 90) ciopts(recast(. rcap))  yline(0, lwidth(vthin) lpattern(dash))   legend(off) xline(2008, lwidth(vthin) lpattern(dash)) graphregion(color(white)) swapnames ytitle("Effect of {&Delta}%Unem. if Corruption=1") ylabel(-0.6(.2)0.4)
graph export "figure_a6_c_1.png", replace height(661) width(908)  

*corruption=0
   foreach y in 1993 1996 2000 2004 2008 2011 2015 {
   regress dif_vpsoe_`y' uc15 unc15 corruption_boom $dcontrols3 [aw=g_census_2008], cluster(prov)
   estimates store reg_`y'
  }
   coefplot (reg_1993, aseq(1993) \ reg_1996, aseq(1996) \ reg_2000, aseq(2000) \ reg_2004, aseq(2004) \ reg_2008, aseq(2008) \ reg_2011, aseq(2011) \ reg_2015, aseq(2015)), keep(unc15) vertical levels(95 90) ciopts(recast(. rcap))  yline(0, lwidth(vthin) lpattern(dash))   legend(off) xline(2008, lwidth(vthin) lpattern(dash)) graphregion(color(white)) swapnames ytitle("Effect of {&Delta}%Unem. if Corruption=0") ylabel(-0.6(.2)0.4)
graph export "figure_a6_c_2.png", replace height(661) width(908)

*interaction
   foreach y in 1993 1996 2000 2004 2008 2011 2015 {
   regress dif_vpsoe_`y' sh_un_2015_2008 sh_un_2015_2008_corruption_boom corruption_boom $dcontrols3 [aw=g_census_2008], cluster(prov)
   estimates store reg_`y'
  }
   coefplot (reg_1993, aseq(1993) \ reg_1996, aseq(1996) \ reg_2000, aseq(2000) \ reg_2004, aseq(2004) \ reg_2008, aseq(2008) \ reg_2011, aseq(2011) \ reg_2015, aseq(2015)), keep(sh_un_2015_2008_corruption_boom) vertical levels(95 90) ciopts(recast(. rcap))  yline(0, lwidth(vthin) lpattern(dash))   legend(off) xline(2008, lwidth(vthin) lpattern(dash)) graphregion(color(white)) swapnames ytitle("Effect of {&Delta}%Unem. x Corruption") ylabel(-0.6(.2)0.4)
graph export "figure_a6_c_3.png", replace height(661) width(908)


*****************************************************
**  Figure A7
*****************************************************
use sss_main.dta, replace

gen uc11=sh_un_2011_2008_corruption_boom
gen unc11=sh_un_2011_2008_ncorruption 

foreach y in 1993 1996 2000 2004 2008 2011 {
regress dfrag_`y' sh_un_2011_2008  $dcontrols3 [aw=g_census_2008], cluster(prov)
estimates store reg_`y'
}
coefplot (reg_1993, aseq(1993) \ reg_1996, aseq(1996) \ reg_2000, aseq(2000) \ reg_2004, aseq(2004) \ reg_2008, aseq(2008) \ reg_2011, aseq(2011)), keep(sh_un_2011_2008) vertical levels(95 90) ciopts(recast(. rcap))  yline(0, lwidth(vthin) lpattern(dash))   legend(off)  graphregion(color(white)) swapnames ytitle("Effect of {&Delta}%Unem.") ylabel(-0.03(.01)0.03)
graph export "figure_a7_a.png", replace height(661) width(908)
  
foreach y in 1993 1996 2000 2004 2008 2011 {
regress dfrag_`y' sh_un_2011_2008 sh_un_2011_2008_corruption_boom corruption_boom  $dcontrols3 [aw=g_census_2008], cluster(prov)
estimates store reg_`y'
}
coefplot (reg_1993, aseq(1993) \ reg_1996, aseq(1996) \ reg_2000, aseq(2000) \ reg_2004, aseq(2004) \ reg_2008, aseq(2008) \ reg_2011, aseq(2011)), keep(corruption_boom) vertical levels(95 90) ciopts(recast(. rcap))  yline(0, lwidth(vthin) lpattern(dash))   legend(off)  graphregion(color(white)) swapnames ytitle("Effect of Corruption") ylabel(-0.08(.02)0.10)
graph export "figure_a7_b.png", replace height(661) width(908)

foreach y in 1993 1996 2000 2004 2008 2011 {
regress dfrag_`y' sh_un_2011_2008 sh_un_2011_2008_corruption_boom corruption_boom  $dcontrols3 [aw=g_census_2008], cluster(prov)
estimates store reg_`y'
}
coefplot (reg_1993, aseq(1993) \ reg_1996, aseq(1996) \ reg_2000, aseq(2000) \ reg_2004, aseq(2004) \ reg_2008, aseq(2008) \ reg_2011, aseq(2011)), keep(sh_un_2011_2008_corruption_boom) vertical levels(95 90) ciopts(recast(. rcap))  yline(0, lwidth(vthin) lpattern(dash))   legend(off)  graphregion(color(white)) swapnames ytitle("Effect of {&Delta}%Unem. x Corruption") ylabel(-0.08(.02)0.10)
graph export "figure_a7_c.png", replace height(661) width(908)


*****************************************************
**  Table A1
*****************************************************
use sss_main.dta, replace

eststo clear
estpost tabstat dfrag_2015 dvmain_2015 dvpp_2015 dvpsoe_2015 dvpod_2015 dvcs_2015 dviu_2015 dturn_2015 dfrag_2011 dvmain_2011 dvpsoe_2011 dvpp_2011     sh_un_2015_2008 sh_un_2011_2008 corruption_boom   age_avg_2008 sh_edu_post_2001 sh_foreign_2008 sh_un_2008   exp_curr_2008 pr_tasac_m2_2008 frag_2008 vpsoe_2008 vpp_2008 viu_2008 vnat_2008 turn_2008, statistics (mean  min  median max sd count p1 p99 ) columns(statistics)
esttab using "table_a1.tex", cells("mean (fmt(%9.3f)) min (fmt(%9.3f)) max (fmt(%9.3f)) sd (fmt(%9.3f)) count (fmt(%9.0f))") noobs replace label

*****************************************************
**  Table A2
*****************************************************
use sss_main.dta, replace

estimates clear

qui eststo reg0: regress dfrag_2015 sh_un_2015_2008 $dcontrols3 [aw=g_census_2008], cluster(prov)
qui eststo reg1: regress dfrag_2015 sh_un_2015_2008 corruption_boom $dcontrols3 [aw=g_census_2008], cluster(prov)
qui eststo reg2: regress dfrag_2015 sh_un_2015_2008 sh_un_2015_2008_corruption_boom corruption_boom $dcontrols3 [aw=g_census_2008], cluster(prov)
qui eststo reg3: regress dfrag_1993 sh_un_2015_2008 sh_un_2015_2008_corruption_boom corruption_boom $dcontrols3 [aw=g_census_2008], cluster(prov)
qui eststo reg4: regress dfrag_1996 sh_un_2015_2008 sh_un_2015_2008_corruption_boom corruption_boom $dcontrols3 [aw=g_census_2008], cluster(prov)
qui eststo reg5: regress dfrag_2000 sh_un_2015_2008 sh_un_2015_2008_corruption_boom corruption_boom $dcontrols3 [aw=g_census_2008], cluster(prov)
qui eststo reg6: regress dfrag_2004 sh_un_2015_2008 sh_un_2015_2008_corruption_boom corruption_boom $dcontrols3 [aw=g_census_2008], cluster(prov)

outreg2 [reg0 reg1 reg2 reg3 reg4 reg5 reg6] using "table_a2.xls", sortvar(sh_un_2015_2008_corruption_boom sh_un_2015_2008 corruption_boom   frag_2008 vpsoe_2008 vpp_2008 viu_2008 vnat_2008 turn_2008 frag_2008  age_avg_2008 sh_un_2008 sh_edu_post_2001 sh_foreign_2008  exp_curr_2008 pr_tasac_m2_2008)   label se replace dec(3)

*****************************************************
**  Appendix B
*****************************************************

*****************************************************
**  Figure B1
*****************************************************
use sss_main.dta, replace

capture erase fcorrupt.gph fncorrupt.gph fdifference.gph

gen diff_fr = dfrag_2015
gen uc15=sh_un_2015_2008_corruption_boom
gen unc15=sh_un_2015_2008_ncorruption

global dcontrols0f
global dcontrols1f i.prov i.pop
global dcontrols2f i.prov i.pop  frag_2008 vpsoe_2008 vpp_2008 viu_2008 vnat_2008 turn_2008
global dcontrols3f i.prov i.pop  frag_2008 vpsoe_2008 vpp_2008 viu_2008 vnat_2008 turn_2008 age_avg_2008 sh_edu_post_2001 sh_foreign_2008 
global dcontrols4f i.prov i.pop  frag_2008 vpsoe_2008 vpp_2008 viu_2008 vnat_2008 turn_2008 age_avg_2008 sh_edu_post_2001 sh_foreign_2008 sh_un_2008  exp_curr_2008 pr_tasac_m2_2008
global dcontrols5f i.prov i.pop  frag_2008 vpsoe_2008 vpp_2008 viu_2008 vnat_2008 turn_2008 age_avg_2008 sh_edu_post_2001 sh_foreign_2008 sh_un_2008  exp_curr_2008 pr_tasac_m2_2008 frag_hist vol_hist ide_hist turn_hist
global dcontrols6f i.prov i.pop  frag_2008 vpsoe_2008 vpp_2008 viu_2008 vnat_2008 turn_2008 age_avg_2008 sh_edu_post_2001 sh_foreign_2008 sh_un_2008  exp_curr_2008 pr_tasac_m2_2008 frag_hist vol_hist ide_hist turn_hist sh_un_2015_2008_vol sh_un_2015_2008_turn sh_un_2015_2008_ide sh_un_2015_2008_frag 
global dcontrols7f i.prov i.pop  frag_2008 vpsoe_2008 vpp_2008 viu_2008 vnat_2008 turn_2008 age_avg_2008 sh_edu_post_2001 sh_foreign_2008 sh_un_2008  exp_curr_2008 pr_tasac_m2_2008 i.prov#i.corruption_boom i.prov##c.sh_un_2015_2008


qui regress diff_fr uc15 unc15 corruption $dcontrols4f [aw=g_census_2008], cluster(prov)

estimates clear
qui eststo f15_0: regress diff_fr uc15 unc15 corruption_boom $dcontrols0f [aw=g_census_2008], cluster(prov)
qui eststo f15_1: regress diff_fr uc15 unc15 corruption_boom $dcontrols1f [aw=g_census_2008], cluster(prov)
qui eststo f15_2: regress diff_fr uc15 unc15 corruption_boom $dcontrols2f [aw=g_census_2008], cluster(prov)
qui eststo f15_3: regress diff_fr uc15 unc15 corruption_boom $dcontrols3f [aw=g_census_2008], cluster(prov)
qui eststo f15_4: regress diff_fr uc15 unc15 corruption_boom $dcontrols4f [aw=g_census_2008], cluster(prov)
qui eststo f15_5: regress diff_fr uc15 unc15 corruption_boom $dcontrols5f [aw=g_census_2008], cluster(prov)
qui eststo f15_6: regress diff_fr uc15 unc15 corruption_boom $dcontrols6f [aw=g_census_2008], cluster(prov)
coefplot f15_1 f15_2 f15_3 f15_4 f15_5 f15_6 , keep(uc15) vertical yline(0, lpattern(dash) lcolor(red)) ylabel(-0.02(0.02)0.08)  legend(off) graphregion(fcolor(white))  levels(95 90) ciopts(recast(. rcap)) saving(fcorrupt.gph, replace)
coefplot f15_1 f15_2 f15_3 f15_4  f15_5 f15_6, keep(unc15) vertical yline(0, lpattern(dash) lcolor(red)) ylabel(-0.02(0.02)0.08) legend(off) graphregion(fcolor(white))  levels(95 90) ciopts(recast(. rcap))  saving(fncorrupt.gph, replace)

estimates clear
qui eststo f15_0: regress diff_fr sh_un_2015_2008_corruption_boom sh_un_2015_2008 corruption_boom $dcontrols0f [aw=g_census_2008], cluster(prov)
qui eststo f15_1: regress diff_fr sh_un_2015_2008_corruption_boom sh_un_2015_2008 corruption_boom $dcontrols1f [aw=g_census_2008], cluster(prov)
qui eststo f15_2: regress diff_fr sh_un_2015_2008_corruption_boom sh_un_2015_2008 corruption_boom $dcontrols2f [aw=g_census_2008], cluster(prov)
qui eststo f15_3: regress diff_fr sh_un_2015_2008_corruption_boom sh_un_2015_2008 corruption_boom $dcontrols3f [aw=g_census_2008], cluster(prov)
qui eststo f15_4: regress diff_fr sh_un_2015_2008_corruption_boom sh_un_2015_2008 corruption_boom $dcontrols4f [aw=g_census_2008], cluster(prov)
qui eststo f15_5: regress diff_fr sh_un_2015_2008_corruption_boom sh_un_2015_2008 corruption_boom $dcontrols5f [aw=g_census_2008], cluster(prov)
qui eststo f15_6: regress diff_fr sh_un_2015_2008_corruption_boom sh_un_2015_2008 corruption_boom $dcontrols6f [aw=g_census_2008], cluster(prov)
qui eststo f15_7: regress diff_fr sh_un_2015_2008_corruption_boom sh_un_2015_2008 corruption_boom $dcontrols7f [aw=g_census_2008], cluster(prov)
coefplot f15_1 f15_2 f15_3 f15_4 f15_5 f15_6 f15_7 , keep(sh_un_2015_2008_corruption_boom) vertical yline(0, lpattern(dash) lcolor(red)) levels(95 90) ciopts(recast(. rcap)) ylabel(-0.02(0.02)0.08)  graphregion(fcolor(white))  /*
*/legend(lab(3 "1) Province & Population FE") lab(6 "2) 1) + Political Variables 2008") lab(9 "3) 2) + Socio-demographics 2008") lab(12 "4) 3) + Economics 2008") lab(15 "5) 4) + Historical political variables") lab(18 "6) 5) + Interaction HistPolVar ") lab(21 "7) 4) + Interaction Province Fixed Effects") /*
*/  region(col(white))) saving(fdifference.gph, replace)

grc1leg2 fcorrupt.gph fncorrupt.gph fdifference.gph, graphregion(fcolor(white)) ycommon col(3) legendfrom(fdifference.gph)
graph export "figure_b1.png", replace height(661) width(908)

*****************************************************
**  Table B1
*****************************************************
use sss_main.dta, replace

foreach x in pr_2015_2008 exp_curr_2014_2008 sh_foreign_2014_2008 population_2014_2008 {
gen un_`x' = sh_un_2015_2008_m*`x'
}

estimates clear
qui eststo reg1: regress dfrag_2015 sh_un_2015_2008 sh_un_2015_2008_corruption_boom corruption_boom                   pr_2015_2008   															un_pr_2015_2008 $dcontrols3 [aw=g_census_2008], cluster(prov)
qui eststo reg2: regress dfrag_2015 sh_un_2015_2008 sh_un_2015_2008_corruption_boom corruption_boom                                exp_curr_2014_2008  											un_exp_curr_2014_2008 $dcontrols3 [aw=g_census_2008], cluster(prov)
qui eststo reg3: regress dfrag_2015 sh_un_2015_2008 sh_un_2015_2008_corruption_boom corruption_boom                                                   sh_foreign_2014_2008  					un_sh_foreign_2014_2008 $dcontrols3 [aw=g_census_2008], cluster(prov)
qui eststo reg4: regress dfrag_2015 sh_un_2015_2008 sh_un_2015_2008_corruption_boom corruption_boom 																	   population_2014_2008 un_population_2014_2008 $dcontrols3 [aw=g_census_2008], cluster(prov)
qui eststo reg5: regress dfrag_2015 sh_un_2015_2008 sh_un_2015_2008_corruption_boom corruption_boom pr_2015_2008 exp_curr_2014_2008 sh_foreign_2014_2008 population_2014_2008  un_pr_2015_2008 un_exp_curr_2014_2008 un_sh_foreign_2014_2008 un_population_2014_2008 $dcontrols3 [aw=g_census_2008], cluster(prov)

outreg2 [reg1 reg2 reg3 reg4 reg5] using "table_b1.xls",  sortvar( sh_un_2015_2008_corruption_boom sh_un_2015_2008 corruption_boom pr_2015_2008 exp_curr_2014_2008 sh_foreign_2014_2008 population_2014_2008 un_pr_2015_2008 un_exp_curr_2014_2008 un_sh_foreign_2014_2008 un_population_2014_2008) keep( sh_un_2015_2008_corruption_boom sh_un_2015_2008 corruption_boom) label se replace dec(3)

*****************************************************
**  Table B2
*****************************************************
use sss_main.dta, replace

foreach x in corruption_crisis {
gen un_`x' = sh_un_2015_2008_m*`x'
}

estimates clear

*baseline effect of unemployment
eststo reg1: regress dfrag_2015 sh_un_2015_2008 corruption_boom $dcontrols3 [aw=g_census_2008], cluster(prov)
eststo reg2: regress dfrag_2015 sh_un_2015_2008 corruption_boom corruption_crisis $dcontrols3 [aw=g_census_2008], cluster(prov)
eststo reg3: regress dfrag_2015 sh_un_2015_2008 corruption_boom $dcontrols3 if (corruption_crisis==0 & corruption_boom==1 | control==1) [aw=g_census_2008], cluster(prov)

*interaction
eststo reg4: regress dfrag_2015 sh_un_2015_2008 sh_un_2015_2008_corruption_boom corruption_boom $dcontrols3 [aw=g_census_2008], cluster(prov)
eststo reg5: regress dfrag_2015 sh_un_2015_2008 sh_un_2015_2008_corruption_boom corruption_boom un_corruption_crisis corruption_crisis $dcontrols3 [aw=g_census_2008], cluster(prov)
eststo reg6: regress dfrag_2015 sh_un_2015_2008 sh_un_2015_2008_corruption_boom corruption_boom $dcontrols3 if (corruption_crisis==0 & corruption_boom==1 | control==1) [aw=g_census_2008], cluster(prov)

outreg2 [reg1 reg2 reg3 reg4 reg5 reg6] using "table_b2.xls", sortvar(sh_un_2015_2008_corruption_boom sh_un_2015_2008  corruption_boom un_corruption_crisis corruption_crisis)  keep(sh_un_2015_2008_corruption_boom sh_un_2015_2008  corruption_boom un_corruption_crisis corruption_crisis) label se replace dec(3)

*****************************************************
**  Table B3
*****************************************************
use sss_main.dta, replace

centile sh_un_2015_2008, centile(33 66)
gen un_low = (sh_un_2015_2008<r(c_1))
gen un_med = (sh_un_2015_2008>r(c_1) & sh_un_2015_2008<r(c_2))
gen un_high = (sh_un_2015_2008>r(c_2))
replace un_low=. if sh_un_2015_2008==.
replace un_med=. if sh_un_2015_2008==.
replace un_high=. if sh_un_2015_2008==.

foreach x of varlist corruption_boom {
gen un_low_`x' = un_low*`x'
gen un_med_`x' = un_med*`x'
gen un_high_`x' = un_high*`x'
}

centile sh_un_2011_2008, centile(33 66)
gen un_low_0811 = (sh_un_2011_2008<r(c_1))
gen un_med_0811 = (sh_un_2011_2008>r(c_1) & sh_un_2011_2008<r(c_2))
gen un_high_0811 = (sh_un_2011_2008>r(c_2))
replace un_low_0811=. if sh_un_2011_2008==.
replace un_med_0811=. if sh_un_2011_2008==.
replace un_high_0811=. if sh_un_2011_2008==.

foreach x of varlist corruption_boom {
gen un_low_0811`x' = un_low_0811*`x'
gen un_med_0811`x' = un_med_0811*`x'
gen un_high_0811`x' = un_high_0811*`x'
}

estimates clear
qui eststo reg1: regress dfrag_2015 sh_un_2015_2008 $dcontrols3 [aw=g_census_2008], cluster(prov)
qui eststo reg2: regress dfrag_2015 un_high un_med un_low $dcontrols3 [aw=g_census_2008], cluster(prov)

qui eststo reg3: regress dfrag_2015 sh_un_2015_2008_corruption_boom sh_un_2015_2008 corruption_boom $dcontrols3  [aw=g_census_2008], cluster(prov)
qui eststo reg4: regress dfrag_2015 un_high_corruption_boom un_med_corruption_boom  un_high un_med un_low corruption_boom $dcontrols3 [aw=g_census_2008], cluster(prov)

outreg2 [reg1 reg2 reg3 reg4] using "table_b3.xls", keep(un_high_corruption_boom un_med_corruption_boom un_low_corruption_boom un_high un_med un_low corruption_boom sh_un_2015_2008_corruption_boom sh_un_2015_2008 un_high_0811corruption_boom un_med_0811corruption_boom un_high_0811 un_med_0811 sh_un_2011_2008_corruption_boom sh_un_2011_2008) label se replace dec(3)

*****************************************************
**  Table B4
*****************************************************
use sss_main.dta, replace

estimates clear
eststo reg0: regress dfrag_2015 sh_un_2015_2008 corruption_boom $dcontrols3  [aw=g_census_2008], cluster(prov)
eststo reg0int: regress dfrag_2015 sh_un_2015_2008 sh_un_2015_2008_corruption_boom corruption_boom $dcontrols3 [aw=g_census_2008], cluster(prov)

eststo reg1: regress dfrag_2015 sh_un_2015_2008 ncorruption_boom $dcontrols3  [aw=g_census_2008], cluster(prov)
eststo reg1int: regress dfrag_2015 sh_un_2015_2008 sh_un_ncorruption_boom ncorruption_boom $dcontrols3 [aw=g_census_2008], cluster(prov)

eststo reg1b: regress dfrag_2015 sh_un_2015_2008 d1 d2 $dcontrols3  [aw=g_census_2008], cluster(prov)
eststo reg1bint: regress dfrag_2015 sh_un_2015_2008 sh_un_d1  sh_un_d2 d1 d2 $dcontrols3 [aw=g_census_2008], cluster(prov)

eststo reg2: regress dfrag_2015 sh_un_2015_2008 c1b c2b c12b  $dcontrols3  [aw=g_census_2008], cluster(prov)
eststo reg2int: regress dfrag_2015 sh_un_2015_2008 sh_un_c1b sh_un_c2b sh_un_c12b c1b c2b c12b $dcontrols3 [aw=g_census_2008], cluster(prov)

outreg2 [reg0 reg0int  reg1 reg1int reg1b reg1bint reg2 reg2int ] using "table_b4.xls",  sortvar(sh_un_2015_2008_corruption_boom corruption_boom sh_un_ncorruption_boom ncorruption_boom sh_un_d1  sh_un_d2 d1 d2  sh_un_c1b sh_un_c2b sh_un_c12b c1b c2b c12b ) keep(sh_un_2015_2008_corruption_boom corruption_boom sh_un_ncorruption_boom ncorruption_boom sh_un_d1  sh_un_d2 d1 d2  sh_un_c1b sh_un_c2b sh_un_c12b c1b c2b c12b ) label se replace dec(3)

*****************************************************
**  Table B5
*****************************************************
use sss_main.dta, replace

estimates clear

eststo reg1: regress dfrag_2015 sh_un_2015_2008 sh_un_2015_2008_corruption_boom corruption_boom $dcontrols3 [aw=g_census_2008], cluster(prov)

use sss_allc.dta, replace

global dcontrols3 i.prov i.pop  frag_2008 vpsoe_2008 vpp_2008 viu_2008 vnat_2008 turn_2008  age_avg_2008 sh_un_2008 sh_edu_post_2001 sh_foreign_2008 exp_curr_2008 pr_tasac_m2_2008

eststo reg2: regress dfrag_2015 sh_un_2015_2008 sh_un_2015_2008_corruption_boom corruption_boom $dcontrols3 if (sample==1) [aw=g_census_2008], cluster(prov)
eststo reg3: regress dfrag_2015 sh_un_2015_2008 sh_un_2015_2008_corruption_boom corruption_boom $dcontrols3 if sample==1 | (PV==1 & population_2008>1000) [aw=g_census_2008], cluster(prov)
eststo reg4: regress dfrag_2015 sh_un_2015_2008 sh_un_2015_2008_corruption_boom corruption_boom $dcontrols3 if sample==1 | (CAT==1 & population_2008>1000) | (PV==1 & population_2008>1000) [aw=g_census_2008], cluster(prov)

outreg2 [reg2 reg3 reg4] using "table_b5.xls", sortvar(sh_un_2015_2008_corruption_boom sh_un_2015_2008 corruption_boom ) keep(sh_un_2015_2008_corruption_boom sh_un_2015_2008 corruption_boom ) label se replace dec(3)


*****************************************************
**  Table B6
*****************************************************
use sss_b6.dta, replace

estimates clear
qui eststo reg1: regress dfrag_2015 sh_un_2015_2008 sh_un_2015_2008_corruption_boom corruption_boom $dcontrols3 if population_2008>1000 [aw=g_census_2008], cluster(prov)
qui eststo reg2: regress dfrag_2015 sh_un_2015_2008 sh_un_2015_2008_corruption_boom corruption_boom $dcontrols3 [aw=g_census_2008], cluster(prov)
qui eststo reg3: regress dfrag_2015 sh_un_2015_2008 sh_un_2015_2008_corruption_boom corruption_boom $dcontrols3 if population_2008>1000 & population_2008<50000  [aw=g_census_2008], cluster(prov)
qui eststo reg4: regress dfrag_2015 sh_un_2015_2008 sh_un_2015_2008_corruption_boom corruption_boom $dcontrols3 if population_2008>1000 & population_2008<100000  [aw=g_census_2008], cluster(prov)

outreg2 [reg1 reg2 reg3 reg4] using "table_b6.xls", keep(sh_un_2015_2008_corruption_boom sh_un_2015_2008 corruption_boom )  sortvar(sh_un_2015_2008_corruption_boom sh_un_2015_2008 corruption_boom ) label se replace dec(3)


*****************************************************
**  Table B7
*****************************************************
use sss_main.dta, replace

estimates clear

qui eststo reg1: regress dfrag_2015 sh_un_2015_2008 sh_un_2015_2008_corruption_boom corruption_boom $dcontrols3 [aw=g_census_2008], cluster(prov)
qui eststo reg2: regress dfrag_2015 sh_un_2015_2008 sh_un_2015_2008_corruption_boom corruption_boom $dcontrols3 [aw=g_census_avg], cluster(prov)
qui eststo reg3: regress dfrag_2015 sh_un_2015_2008 sh_un_2015_2008_corruption_boom corruption_boom $dcontrols3 [aw=population_2008], cluster(prov)
qui eststo reg4: regress dfrag_2015 sh_un_2015_2008 sh_un_2015_2008_corruption_boom corruption_boom $dcontrols3 [aw=population_avg], cluster(prov)
qui eststo reg5: regress dfrag_2015 sh_un_2015_2008 sh_un_2015_2008_corruption_boom corruption_boom $dcontrols3 , cluster(prov)

outreg2 [reg1 reg2 reg3 reg4 reg5] using "table_b7.xls", keep(sh_un_2015_2008 corruption_boom sh_un_2015_2008_corruption_boom) sortvar(sh_un_2015_2008_corruption_boom sh_un_2015_2008 corruption_boom) label se replace dec(3)

*****************************************************
**  Table B8
*****************************************************
use sss_main.dta, replace

estimates clear

eststo reg1: regress dfrag_2015 sh_un_2015_2008_corruption_boom sh_un_2015_2008 corruption_boom $dcontrols3 [aw=g_census_2008], cluster(prov)
eststo reg2: regress dfrag_2015 sh_un_2015_2008 sh_un_lm_ex_2015_2008 corruption_boom      sh_corruption_boom_lm_ex      sh_un_2015_2008_corruption_boom un0815_lm_ex_corr_boom_lm_ex     $dcontrols3 	[aw=g_census_2008], cluster(lm)

outreg2 [reg1 reg2] using "table_b8.xls", keep(sh_un_2015_2008_corruption_boom un0815_lm_ex_corr_boom_lm_ex corruption_boom sh_corruption_boom_lm_ex  sh_un_2015_2008 sh_un_lm_ex_2015_2008 corruption_boom      sh_corruption_boom_lm_ex  ) label se replace dec(3)
